/*
 ============================================================================
 Page	     : 391-392
 Name        : r_drive.c - 测试 rand1() 和 srand1()
 Date	     : 20210407
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 测试rand1()和srand1()
 	 	 	   与s_and_r.c一起编译
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
extern void srand1(unsigned int x);
extern int rand1(void);

int main()
{
	unsigned seed = 0;

	printf("Please enter your choice for seed.\n");
	while(scanf("%u", &seed) == 1)
	{
		srand1(seed);		/* 重置种子 */
		for(int count = 0; count < 5; count++)
		{
			printf("%d\n", rand1());
		}
		printf("Please enter next seed (q to quit):\n");
	}
	printf("Done\n");

	return 0;
}

